import { SReward } from "../../../../../../Message/Public/SReward";
import { EReward } from "../../../../../../Message/Public/EReward";
import { GameDefConfig } from "../../../../resource/GameDefConfig";
import { ItemsUtil } from "../../../shortcuts/item/ItemsUtil";
import { ItemData } from "../../../../resource/info/ItemData";
import { HTMLUtil } from "../../../../../../com/gengine/utils/HTMLUtil";
//class PetCpnRewardUtil
    
    export  class PetCpnRewardUtil
    {
        

        public static getStrByReward(arg1: SReward, arg2: string="×", arg3: Boolean=true): string
        {
            var loc2=null;
            var loc3=null;
            var loc1="";
            var loc4="#f0ea3f";
            if (arg1) 
            {
                if (arg1.type != EReward._ERewardItem) 
                {
                    loc2 = GameDefConfig.instance.getERewardName(arg1.type);
                    if (arg1.type != EReward._ERewardGoldBind) 
                    {
                        if (arg1.type == EReward._ERewardPetCoin) 
                        {
                            loc4 = "#FF7902";
                        }
                    }
                    else 
                    {
                        loc4 = "#FF00FF";
                    }
                }
                else 
                {
                    loc2 = ItemsUtil.getItemName(new ItemData(arg1.code));
                }
                loc3 = arg1.num.toString();
                if (arg3) 
                {
                    loc1 = loc2 + arg2 + loc3;
                }
                else 
                {
                    loc1 = loc3 + arg2 + loc2;
                }
                loc1 = HTMLUtil.addColor(loc1, loc4);
            }
            return loc1;
        }

        public static getStrByRewardArray(arg1: Array<any>, arg2: string="，"): string
        {
            var loc2=null;
            var loc1="";
            var loc3=0;
            while (loc3 < arg1.length) 
            {
                loc2 = arg1[loc3];
                loc1 = loc1 + PetCpnRewardUtil.getStrByReward(loc2);
                if (loc3 != (arg1.length - 1)) 
                {
                    loc1 = loc1 + arg2;
                }
                ++loc3;
            }
            return loc1;
        }
    }
